:root{
  --side-pad: 90px;
  --thumb-gap: 8px;
  --strip-thumb-h: 56px;
  --bg:#858585; --text:#000000; --sub:#6b7280; --line:#818181;
  --chip:#f3f4f6; --blue:#0a84ff; --shadow: 0 8px 24px rgba(0,0,0,.08);
}
*{ box-sizing:border-box; }

/* ---------- Header ---------- */
.ios-library .appbar{ position:sticky; top:0; z-index:1000; background:transparent; box-shadow:none; }
.ios-library .appbar-inner{ padding:10px var(--side-pad) 12px; }
.ios-library .toolbar{ display:flex; align-items:center; gap:12px; }
.ios-library .search-btn{ margin-left:auto; width:36px; height:36px; border-radius:50%; display:grid; place-items:center; background:var(--chip); color:var(--blue); }
.ios-library .pill{ height:32px; padding:0 14px; border-radius:16px; display:inline-grid; place-items:center; background:var(--chip); font-weight:600; font-size:14px; }
.ios-library .avatar{ width:36px; height:36px; border-radius:50%; display:grid; place-items:center; background:#d1d5db; font-weight:700; }
.ios-library .title{ margin-top:6px; }
.ios-library .title h1{ margin:0; font-size:32px; line-height:1.1; font-weight:800; letter-spacing:.2px; }
.ios-library .subtitle{ margin-top:6px; color:var(--sub); font-size:14px; }

/* ---------- Grid ---------- */
.ios-library .page{ padding:0 var(--side-pad); }
.ios-library .grid{ width:100%; padding:8px 0; display:grid; grid-template-columns: repeat(5, 1fr); gap: var(--thumb-gap); }
.ios-library .thumb{ position:relative; overflow:hidden; background:#767676; box-shadow:0 1px 2px rgba(0,0,0,.04); aspect-ratio:3/4; cursor:pointer; }
.ios-library .thumb, .ios-library .thumb img{ border-radius:0; }
.ios-library .thumb img{ width:100%; height:100%; object-fit:cover; display:block; }
/* fav マーク（白） */
.ios-library .thumb.fav::after{
  content:"♥"; position:absolute; right:6px; bottom:6px; font-size:18px; color:#fff;
  text-shadow:0 0 6px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.45);
}
/* お気に入りモード */
.ios-library.mode-fav .page .grid .thumb:not(.fav){ display:none; }

/* ---------- Segment ---------- */
.ios-library .seg-floating{
  position:fixed; left:50%; bottom:20px; transform:translateX(-50%);
  background:rgba(255,255,255,.92); backdrop-filter:saturate(180%) blur(12px);
  border:1px solid var(--line); border-radius:999px; box-shadow:var(--shadow);
  display:flex; gap:2px; padding:6px; z-index:1100;
}
.ios-library .seg-btn{ border:0; background:transparent; font-weight:600; font-size:14px; padding:8px 16px; border-radius:999px; cursor:pointer; user-select:none; }
.ios-library .seg-btn.active{ background:var(--text); color:#fff; }

/* ---------- Type View ---------- */
.ios-library .type-view{ display:none; padding: 0 var(--side-pad) 56px; transform: scale(0.6); transform-origin: top left; margin-left: 10vw; }
.ios-library.mode-type .page{ display:none; }
.ios-library.mode-type .type-view{ display:block; }
.ios-library .type-section{ margin:0 0 60px; }
.ios-library .type-title{ margin:0 0 10px; font-size:30px; font-weight:800; letter-spacing:.3px; }
.ios-library .mosaic{ display:grid; grid-template-columns:1fr; gap:4px; }
.ios-library .card{ background:#fff; overflow:hidden; box-shadow:0 6px 16px rgba(0,0,0,.08); cursor:pointer; }
.ios-library .card img{ width:100%; height:100%; object-fit:cover; display:block; }
.ios-library .card, .ios-library .card img{ border-radius:0; }
.ios-library .card-hero{ aspect-ratio:16/9; }
.ios-library .mini-row{ display:grid; grid-template-columns:repeat(3,1fr); gap:4px; }
.ios-library .card-mini{ aspect-ratio:1/1; }

/* ---------- Type Full Overlay ---------- */
.ios-library .overlay{ position:fixed; inset:0; background:#fff; z-index:1300; display:none; flex-direction:column; }
.ios-library .overlay.show{ display:flex; }
.ios-library .overlay-appbar{ position:sticky; top:0; z-index:1; background:rgba(255,255,255,.95); border-bottom:1px solid var(--line); }
.ios-library .overlay-appbar .appbar-inner{ padding:10px var(--side-pad) 12px; }
.ios-library .overlay-appbar .toolbar{ display:flex; align-items:center; gap:12px; }
.ios-library .overlay-back{ width:36px; height:36px; border-radius:50%; border:1px solid var(--line); display:grid; place-items:center; background:#fff; font-weight:800; cursor:pointer; }
.ios-library .overlay-title{ margin-top:6px; }
.ios-library .overlay-title h1{ margin:0; font-size:32px; line-height:1.1; font-weight:800; }
.ios-library .overlay-body{ padding:10px var(--side-pad) 40px; overflow:auto; flex:1; }
.ios-library .overlay-grid{ display:grid; grid-template-columns: repeat(5, 1fr); gap: var(--thumb-gap); }
.ios-library .overlay-grid .thumb{ aspect-ratio:3/4; }

/* ---------- Viewer（拡大表示） ---------- */
.viewer{
  position:fixed; inset:0;
  background:rgba(255,255,255,0.35);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  z-index:1400; display:none; flex-direction:column;
}
.viewer.show{ display:flex; }

/* 細いヘッダー＋左戻る＋右三点 */
.viewer-header{
  position:sticky; top:0; height:40px; z-index:3;
  display:flex; align-items:center; justify-content:center; gap:8px;
  padding:6px 12px; background:rgba(255,255,255,0.75);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom:1px solid rgba(0,0,0,0.05);
}
.viewer-back, .viewer-menu{
  position:absolute; top:6px; width:36px; height:36px; border-radius:50%;
  background:#fff; border:none; box-shadow:0 4px 12px rgba(0,0,0,.12);
  display:grid; place-items:center; cursor:pointer;
}
.viewer-back{ left:12px; }
.viewer-menu{ right:12px; }
.viewer-back svg, .viewer-menu svg{ width:18px; height:18px; }
.viewer-title{ text-align:center; line-height:1.1; }
.viewer-title .date{ font-weight:800; font-size:16px; display:block; }
.viewer-title .time{ font-size:12px; color:var(--sub); display:block; margin-top:2px; }

/* メイン画像（左右に余白・奥のライブラリが透ける） */
.viewer-main{ flex:1; display:grid; place-items:center; overflow:hidden; position:relative; background:transparent; }
.viewer-main img{
  max-width:80vw; max-height:calc(100vh - 40px - 110px);
  object-fit:contain; box-shadow:0 8px 24px rgba(0,0,0,.15); border-radius:0;
}
.viewer-main::before, .viewer-main::after{
  content:""; position:absolute; top:0; bottom:0; width:120px; pointer-events:none; z-index:2;
}
.viewer-main::before{ left:0;  background:linear-gradient(to right, rgba(255,255,255,0.35), transparent); }
.viewer-main::after { right:0; background:linear-gradient(to left,  rgba(255,255,255,0.35), transparent); }

/* 小窓（中央重ね・3:4・背景なし） */
.viewer-strip{
  position:absolute; bottom:92px; left:50%; transform:translateX(-50%);
  height:calc(var(--strip-thumb-h) + 8px);
  display:flex; align-items:center; gap:6px;
  overflow-x:auto; overscroll-behavior-x:contain; background:transparent; z-index:4;
}
.viewer-thumb{
  flex:0 0 auto; height:var(--strip-thumb-h); width:calc(var(--strip-thumb-h)*0.75);
  border:none; box-shadow:0 1px 3px rgba(0,0,0,.08); cursor:pointer; transition:transform .18s ease; border-radius:0;
}
.viewer-thumb img{ width:100%; height:100%; object-fit:cover; display:block; border-radius:0; }
.viewer-thumb.active{ outline:2px solid var(--blue); outline-offset:2px; transform:scale(1.05); }

/* 下部ツール（3つ） */
.viewer-toolbar{
  position:absolute; left:50%; bottom:10px; transform:translateX(-50%);
  display:flex; align-items:center; gap:28px;
  background:rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border:1px solid rgba(0,0,0,0.06); border-radius:30px;
  padding:12px 20px; box-shadow:0 10px 30px rgba(0,0,0,.12); z-index:5;
}
.viewer-tool{
  width:56px; height:56px; border-radius:50%;
  background:#fff; border:1px solid rgba(0,0,0,0.08);
  display:grid; place-items:center; cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,.08);
}
/* いいねの見た目：favで塗りつぶし */
.viewer-tool.like svg{ width:26px; height:26px; stroke:#0a84ff; fill:none; }
.viewer-tool.like.is-liked svg{ stroke:#0a84ff; fill:#0a84ff; }
.viewer-tool.adjust svg, .viewer-tool.trash svg{ width:26px; height:26px; color:#0a84ff; }

/* ---------- Responsive ---------- */
@media (max-width:1280px){
  .ios-library .grid, .ios-library .overlay-grid{ grid-template-columns: repeat(4, 1fr); }
}
@media (max-width:920px){
  .ios-library .grid, .ios-library .overlay-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width:640px){
  .ios-library .grid, .ios-library .overlay-grid{ grid-template-columns: repeat(2, 1fr); }
  .ios-library .title h1, .ios-library .overlay-title h1{ font-size:26px; }
  .ios-library .type-title{ font-size:26px; }
}
/* 追加：main を前面に出してクリック可能にする */
main {
  position: relative; /* スタッキングコンテキストを作る */
  z-index: 1000;      /* all.css の header/figure より大きい値を指定 */
  background: #ffffff;/* 必要なら背景も明示する */
}

/* もし header の背景画像がクリックを奪っているならオーバーライド（all.cssを変えずに上書き） */
header figure {
  pointer-events: none; /* header 内の背景はクリックを受け取らない */
}

/* 必要なら header 内のメニューは明示的にクリック可能にする */
header ul, header a {
  pointer-events: auto;
  position: relative;
  z-index: 1010; /* メニューを main より上に見せたい場合は調整 */
}
:root {
  --text: #000;
  --sub: #737373;
  --line: #dbdbdb;
  --bg: #fff;
  --blue: #0095f6;
  --light-bg: #fafafa;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial;
  background:#ffffff; /* ページ全体の背景を白に */
  color: #000000; /* 文字色も黒で見やすく */
}


/* ---------- Layout ---------- */
.container {
  max-width: 935px;
  margin: 0 auto;
  padding-bottom: 40px;
}

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 20px;
}
.topbar svg { fill: var(--text); }

/* ---------- Profile Section ---------- */
.profile {
  display: flex;
  align-items: center;
  gap: 60px;
  padding: 40px 0 24px;
}
.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: url('../images/10a.jpeg') center/cover no-repeat;
}
.info { flex: 1; }
.username {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.username h2 {
  font-size: 28px;
  font-weight: 400;
}
.btns { display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 16px;
  font-weight: 600;
  font-size: 14px;
  background: var(--light-bg);
  cursor: pointer;
}
.btn.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.stats {
  display: flex;
  gap: 40px;
  margin-bottom: 16px;
}
.stat .num { font-weight: 700; }
.bio {
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Highlights ---------- */
.highlights {
  display: flex;
  gap: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.story {
  text-align: center;
  cursor: pointer;
}
.story img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
}
.story .cap {
  font-size: 13px;
  color: var(--sub);
  margin-top: 6px;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin-top: 20px;
}
.post {
  position: relative;
  aspect-ratio: 3/ 4;
  cursor: pointer;
}
.post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay p {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.post:hover .overlay { opacity: 1; }

/* ---------- Story Modal ---------- */
#highlightModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#highlightModal.active { display: flex; }

.story-viewer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-viewer img {
  width: auto;
  height: 80vh;
  border-radius: 16px;
  object-fit: cover;
}
.progress-container {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar div {
  height: 100%;
  width: 0%;
  background: #fff;
  transition: width linear;
}
.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
}
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 48px;
  color: #fff;
  cursor: pointer;
  opacity: 0.6;
}
.arrow.left { left: 30px; }
.arrow.right { right: 30px; }
.arrow:hover { opacity: 1; }

/* ---------- Post Modal ---------- */
#postModal {
  position: fixed;
  inset: 0;
  background: #fff;
  display: none;
  z-index: 1500;
}
#postModal.active { display: block; }
.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  font-size: 24px;
  font-weight: 600;
  border: none;
  background: none;
  color: #111;
  cursor: pointer;
  z-index: 1600;
}
.post-scroll {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}
.post-page {
  height: 100vh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.image-container {
  position: relative;
  width: 60%;
  max-width: 700px;
  height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.image-container img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .4s ease;
}
.image-container img.active { opacity: 1; }
.arrow.white {
  color: #111;
  opacity: 0.3;
}
.arrow.white:hover { opacity: 1; }
.caption {
  width: 60%;
  max-width: 700px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  font-size: 16px;
  line-height: 1.6;
  color: var(--sub);
  text-align: left;
}
/* 9:16フレーム（画像をこの中で重ねる） */
.story-viewer{
  position: relative;
  width: auto;
  height: 80vh;
  aspect-ratio: 9/16;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,.4);
  background: #000;
}

/* A/B 2レイヤーを重ね、.active だけ見せる */
.story-img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;                 /* ← デフォルトは非表示 */
  transition: opacity .35s ease;
}
.story-img.active{
  opacity: 1;                 /* ← 表示するのは .active だけ */
}

/* 既存の .story-viewer img という汎用指定があれば無効化（削除 or 上記で上書き） */
/* メインコンテナ（プロフィール〜グリッド） */
main {
  background: #ffffff;
}

/* 投稿グリッドやプロフィールカードが半透明やグレーだった場合 */
.profile, .grid, .highlights {
  background: #777676;
}

/* 各カード間に白背景を維持したまま軽い影を加えると自然 */
.grid .post img {
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.04);
}


/* 追加：main を前面に出してクリック可能にする */
main {
  position: relative; /* スタッキングコンテキストを作る */
  z-index: 1000;      /* all.css の header/figure より大きい値を指定 */
  background: #ffffff;/* 必要なら背景も明示する */
}

/* もし header の背景画像がクリックを奪っているならオーバーライド（all.cssを変えずに上書き） */
header figure {
  pointer-events: none; /* header 内の背景はクリックを受け取らない */
}

/* 必要なら header 内のメニューは明示的にクリック可能にする */
header ul, header a {
  pointer-events: auto;
  position: relative;
  z-index: 1010; /* メニューを main より上に見せたい場合は調整 */
}
main{
  padding-bottom: 60px;
}